import request from '@/utils/request'

/**
 * 样品登记
 **/

export function sampleManageList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  // var createString = ""
  // if (data.createTimeList !== undefined && data.createTimeList !== null && data.createTimeList.length !== 0) {
  //   createString = "?createTimeList=" + data.createTimeList[0] + "&createTimeList=" + data.createTimeList[1]
  // }
  // if (data.sampleReceivingDateList !== undefined && data.sampleReceivingDateList !== null && data.sampleReceivingDateList.length !== 0) {
  //   if (createString !== "") {
  //     createString += "&"
  //   } else {
  //     createString = "?"
  //   }
  //   createString += "sampleReceivingDateList=" + data.sampleReceivingDateList[0] + "&sampleReceivingDateList=" + data.sampleReceivingDateList[1]
  // }
  // + createString
  return request({
    url: '/api/v1/SampleRegistration/SampleManageList',
    method: 'post',
    data
  })
}

export function GetSampleRegistrationDetectionItem(data) {
  return request({
    url: '/api/v1/SampleRegistration/GetSampleRegistrationDetectionItem',
    method: 'get',
    params: data
  })
}

export function getSampleNumber(data) {
  return request({
    url: '/api/v1/SampleRegistration/GetSampleNumber',
    method: 'post',
    data
  })
}

export function create(data) {
  return request({
    url: '/api/v1/SampleRegistration/Create',
    method: 'post',
    data
  })
}

export function deleteRecord(data) {
  return request({
    url: '/api/v1/SampleRegistration/Delete',
    method: 'delete',
    data
  })
}

export function update(data) {
  return request({
    url: '/api/v1/SampleRegistration/Update',
    method: 'post',
    data
  })
}

export function getSampleRegistrationList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/SampleRegistration/GetList',
    method: 'get',
    params: data
  })
}

export function GetSampleRegistrationMaggess(data) {
  return request({
    url: '/api/v1/SampleRegistration/GetSampleRegistrationMaggess',
    method: 'get',
    params: data
  })
}
